using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Manoli.Utils.CSharpFormat;

public partial class BorderLayoutSample : System.Web.UI.Page
{
    protected string sourceHtml
    {
        get
        {
            return ViewState["sourceHtml"] != null ? ViewState["sourceHtml"].ToString() : "Click on an example to see the source here";
        }
        set
        {
            ViewState["sourceHtml"] = value;
        }
    }
    protected string sourceCS
    {
        get
        {
            return ViewState["sourceCS"] != null ? ViewState["sourceCS"].ToString() : "";
        }
        set
        {
            ViewState["sourceCS"] = value;
        }
    }


    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Request.Browser.Browser=="IE")
        //{
        //    Response.Redirect("Default2.aspx");
        //}
    }
    protected void TreePane_NodeClicked(object sender, GridControl.NodeClickedEventArgs e)
    {
        string fileName = e.NodeClicked.id+".aspx";
        System.IO.StreamReader read = new System.IO.StreamReader(Server.MapPath(fileName));
        string source = read.ReadToEnd();
        read.Close();
        read.Dispose();
        HtmlFormat htmformat = new HtmlFormat();
        CSharpFormat format = new CSharpFormat();
        sourceHtml = htmformat.FormatCode(source);
        
        fileName = e.NodeClicked.id + ".aspx.cs";
        System.IO.StreamReader readcs = new System.IO.StreamReader(Server.MapPath(fileName));
        source = readcs.ReadToEnd();
        readcs.Close();
        readcs.Dispose();
        //
        sourceCS = format.FormatCode(source);


    }
}
